package com.itheima_02;

public class Student {
    //封装
    private String name;
    private int age;

    public void setName(String s) {
        name = s;
    }

    public String getName() {
        return name;
    }

    public void setAge(int i) {
        if (i < 0 || i > 100) {
            System.out.println("您输入的年龄有误。");
        } else {
            age = i;
        }
    }

    public int getAge() {
        return age;
    }

    public void show() {
        System.out.println(name + "  " + age);
    }
}
